﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SerienNewsReaderMVVM
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

         /// <summary>
        /// Generates all entries for the Filter menue
        /// </summary>
        private void BuildFilterMenu()
        {
            if (this.menuItemFilters.Items.Count > 0)
            {
                this.menuItemFilters.Items.Clear();
            }
            MenuItem allSeries = new MenuItem();
            allSeries.Header = "All Series";

            if (!String.IsNullOrEmpty(SerienNewsReader.config.Default.Series))
            {
                string[] entries = SerienNewsReader.config.Default.Series.Split(';');
                if (entries.Length > 0)
                {
                    foreach (string entry in entries)
                    {
                        if (!string.IsNullOrEmpty(entry))
                        {
                            MenuItem item = new MenuItem();
                            item.Header = entry;
                            //item.Click += new RoutedEventHandler(this.FilterItem_Click);
                            this.menuItemFilters.Items.Add(item);
                            //this.titles.Add(entry);
                        }
                    }
                }
                //MenuItem allFilters = new MenuItem();
                //allFilters.Header = "All my series";
                //allFilters.Click +=new RoutedEventHandler(allFilters_Click);
                //allFilters.IsEnabled = true;
                //this.menuItemFilters.Items.Add(new Separator());
                //this.menuItemFilters.Items.Add(allFilters);
            }
        }
    }
}
